package com.gec.system;

import com.gec.system.system.SysRole;
import com.gec.system.mapper.SysRoleMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class ApplicationTests {
    @Autowired
    SysRoleMapper mapper;
    @Autowired
    ApplicationContext context;
    @Test
    public void test1(){
        List<SysRole> sysRoles = mapper.selectList(null);
        sysRoles.forEach(System.out::println);
    }
    @Test
    public void test2(){
        SysRole sysRole = new SysRole();
        sysRole.setRoleName("测试账号");
        sysRole.setRoleCode("testadmin");
        sysRole.setDescription("测试账号");
        int insert = mapper.insert(sysRole);
    }
    @Test
    public void test3(){

        String[] names = context.getBeanDefinitionNames();

        for (String name : names) {
            if (name.contains("mybatis"))
            {
                System.out.println(name);

            }
        }
    }



}
